﻿using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Bass.Tools;
using MySql.Data.MySqlClient;

public partial class sdfeed : System.Web.UI.Page 
{

    protected void Page_Load(object sender, EventArgs e)
    {
        dlBind();
    }

    public void dlBind()
    {

        //int curpage = Convert.ToInt32(this.lblCurPage.Text);

        //先定义一个PageDataSource,分页全靠它
        //PagedDataSource ps = new PagedDataSource();

        //取到连接字符串
        string propertiesPath = Server.MapPath("mysqldb.properties");
        mytools mt = new mytools();
        string ConnString = mt.getMysqlConn(propertiesPath);

        //打开连接
        MySqlConnection myConnection = new MySqlConnection(ConnString);
        myConnection.Open();

        //定义一个MySqlDataAdapter
        MySqlDataAdapter myAdapter = new MySqlDataAdapter();

        DateTime dt = Convert.ToDateTime(DateTime.Now);
        string nowtime = dt.ToString("yyyyMMddHHmmss");

        string nowdate = mt.Substring(nowtime, 0,8);
        string comparetime = nowdate + "000000";

        string sql="select * from product_info where addtime> '"+comparetime+ "'order by addtime desc";
        myAdapter = new MySqlDataAdapter(sql, myConnection);
        
        DataSet ds = new DataSet();
        //填充数据
        myAdapter.Fill(ds, "mytable");
        this.sdRSS.DataSource = ds.Tables["mytable"].DefaultView;
        this.sdRSS.DataBind();

        myConnection.Close();

    }

    
    protected string Substring(string str, int i, int j)
    {
        mytools mt = new mytools();
        string resultstr = mt.Substring(str, i, j);
        return resultstr;
    }

    protected string ReformDate(string addtime)
    {
        mytools mt = new mytools();
        string datereformed = mt.ReformDate(addtime);
        return datereformed;
    }
    
}
